<template>
    <div>
        <el-card>
            <template #header>
                <div>
                    <span>企业名称:</span>
                    <el-select v-model="enterpriseCode" filterable clearable placeholder="请选择公司名称"
                        >
                        <el-option v-for="item in options" :key="item.enterpriseId" :label="item.cmpName"
                            :value="item.enterpriseCode" />
                    </el-select>
                </div>
            </template>
            <el-table ref="enterpriseRef" :data="tableData" style="width: 100%; max-height: 61vh; height: 61vh"
                table-layout="auto" v-loading="loading">
                <el-table-column fixed prop="enterName" label="计入年度(年)" />
                <el-table-column prop="enterpriseCode" label="年度增加值(万元)" />
                <el-table-column prop="dataCode" label="年度产值(万元)" />
                <el-table-column prop="dataValue" label="年度销售收入(万元)" />
                <el-table-column prop="convertRation" label="备注" />
            </el-table>
            <!-- <div class="card-footer">
                <span class="total-font">总数:{{ pagination.total }}</span>
                <el-pagination layout="prev, pager, next, sizes" v-model:page-size="pagination.size"
                    v-model:current-page="pagination.page" :total="pagination.total" @size-change="sizeChange"
                    @current-change="pageChange" class="pagination" />
            </div> -->
        </el-card>
    </div>
</template>

<script setup>
import { list9 } from '@/api/enterpriseArchives'
import { getNameById,getNameList } from '@/api/enterprise'
import { reactive, ref } from "vue";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const enterpriseCode = ref("");
const options = ref([]);
const Store = useStore();
const { userInfo } = storeToRefs(Store);
const tableData = ref([]);
const loading = ref(true);
const disabled = ref(false);
const pagination = reactive({
    page: 1,
    size: 10,
    total: 0,
});
const init = async () => {
    let user = userInfo.value;
    console.log(user.roleId)
    getNameList()
    .then((res) => {
      options.value = res.data;
      if(user.roleId != "3"){
        enterpriseCode.value = user.userName;
        disabled.value = true;
      }
    })
    .catch((msg) => {
      console.log();
    });
    getNameById({ enterpriseCode: user.userName }).then((res) => {
        console.log(res)
    }).catch((msg) => {

    })
    // list9().then((res) => {

    // }).catch((msg) => {

    // })
}
init()
</script>

<style scoped></style>